<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.org/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximumscale=1">
    <title>layui布局</title>
    <!--第一步，引入layui的资源-->
    <link rel="stylesheet" th:href="@{/resources/layui/css/layui.css}">
</head>
<body>
<input type="hidden" id="outrecordid">
<form class="layui-form" action=" " id="applyList" th:inline="none">
    <div class="layui-form-item">
        <label class="layui-form-label">车牌号码</label>
        <div class="layui-input-block" >
            <select id="vid">
                <option value="0">请选择</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">驾驶员</label>
        <div class="layui-input-block" >
            <select id="driverid">
                <option value="0">请选择</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label">出车时间</label>
    <div class="layui-input-block">
        <input type="datetime-local" id="outtime"  name="outtime" required  lay-verify="required"  autocomplete="off" class="layui-input">
    </div>
</div>
    <div class="layui-form-item">
        <label class="layui-form-label">回车时间</label>
        <div class="layui-input-block">
            <input type="datetime-local"  id="returntime" name="returntime" required  lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">停放位置</label>
        <div class="layui-input-block">
            <input type="text"  id="position" name="position" required  lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">备注信息</label>
        <div class="layui-input-block">
            <input type="text"  id="information" name="information" required  lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
</form>
<!--在body下引入js资源-->
<script th:src="@{/resources/layui/layui.js}"></script>
<!--开始写，layui的资源-->
<script th:inline="none">//此处有坑，需要设置“th:inline="none"”
//一般直接写在一个js文件中
//同时，在layui中引入table表格
layui.use(['layer', 'form', 'table'], function () {
    var layer = layui.layer
        , form = layui.form
        , table = layui.table
        , $ = layui.jquery;

    $.ajax({
        url:"/outrecord/selectOutrecordById",
        type:"get",
        data:{outrecordid:$("#outrecordid").val()},
        success:function (res){
            var outrecord=res.data.outrecord;
            var outtime =outrecord.outtime.replace(" ","T")
            $("#outtime").val(outtime);
            $("#outtime").attr("disabled","disabled");
            $("#vid").append("<option value='"+outrecord.vehiclefiles.id+"' selected='selected' >"+outrecord.vehiclefiles.vehiclenum+"</option>")
            $("#vid").attr("disabled","disabled");
            $("#driverid").append("<option value='" +outrecord. driver.id + "'selected='selected'  >" + outrecord.driver.name + "</option> ")
            $("#driverid").attr("disabled","disabled");
            layui.form.render("select");
        }
    })
});
var callbackdata=function(){
    //返回值没有data的话父页面拿不到id的值
    var id=document.getElementById('outrecordid').value;
    var vid=document.getElementById('vid').value;
    var outtime=document.getElementById('outtime').value;
    var returntime=document.getElementById('returntime').value;
    var driverid=document.getElementById('driverid').value;
    var position=document.getElementById('position').value;
    var information=document.getElementById('information').value;
    var obj={
        id:id,
        vid:vid,
        outtime:outtime,
        returntime:returntime,
        driverid:driverid,
        position:position,
        information:information,
    }
    return obj;
}
    //引入jquery
</script>
</body>
</html>